<%-- 
    Document   : verifica
    Created on : 11/03/2009, 05:29:59 PM
    Author     : Ricardo
--%>
<%@page session="true"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*"%>
<%@page import="com.market.datos.cDatos" %>

<%
            String xnick = request.getParameter("xnick");
            String xcla = request.getParameter("xcla");
            cDatos objCon = new cDatos();

            objCon.openConnection();
            String sql = "SELECT COUNT(*) AS cant FROM usuario WHERE usu_nick='";
            sql += xnick + "' AND usu_password='" + xcla + "'";
            Vector vr = objCon.query(sql);
            Vector v1 = (Vector) vr.get(0);
            String dato = (String) v1.get(0);
            int xcant = Integer.parseInt(dato);

                        
            if (xcant > 0) {
               
                session.setAttribute("nick", xnick);
                session.setAttribute("clave", xcla);
                response.sendRedirect("entorno.jsp");
            } else {
                request.setAttribute("xmsg", "Error: Usuario o Contraseña incorrecta");
                request.getRequestDispatcher("logueo.jsp").forward(request, response);
            //response.sendRedirect( "index.jsp");
            }

%>
